<?php
/**
 * Created by PhpStorm.
 * User: 会吃草的鱼
 * Date: 16/8/9
 * Time: 10:18
 */

namespace Recruit\Api;


use Common\Api\Api;

class CommonMemberApi extends Api
{
    /*
         * 3表联合查询获得后台操作员信息
         * */
    const JOIN_RULES_GET = 'Recruit/CommonMember/joinrulesget';

    protected function _init()
    {
        $this->model = M('member','common_');
    }

    public function joinrulesget($map = null, $order = false, $fields = false){
        $query = $this->model->join('JOIN common_auth_group_access ON common_member.uid = common_auth_group_access.uid')->join('JOIN common_auth_group ON common_auth_group_access.group_id = common_auth_group.id');
        if(!is_null($map)){
            $query = $query->where($map);
        }

        if(!($order === false)){
            $query = $query->order($order);
        }
        if(!($fields === false)){
            $query = $query->field($fields);
        }
        $list = $query-> find();
        if ($list === false) {
            $error = $this -> model -> getDbError();
            return $this -> apiReturnErr($error);
        }
        return $this -> apiReturnSuc($list);
    }
}